package com.example.springboot.mapper;


import com.example.springboot.pojo.Building;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BuildingMapper {

    @Select("select * from building")
    List<Building> getAllBuilding();

    @Insert("insert into building(building,unit_count,floor_count,room_count) values(#{building},#{unitCount},#{floorCount},#{roomCount})")
    void addBuilding(String building, Integer unitCount, Integer floorCount, Integer roomCount);

    @Delete("delete from building where building=#{building}")
    void deleteBuilding(String building);

    @Update("update building set unit_count=#{unitCount},floor_count=#{floorCount},room_count=#{roomCount} where building=#{building}")
    void updateBuilding(String building, Integer unitCount, Integer floorCount, Integer roomCount);

    @Select("select * from building where building=#{building}")
    Building findBuilding(String building);
}
